package com.wjl.shop.controller;

import com.wjl.shop.entity.Product;
import com.wjl.shop.service.ProductService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 产品信息表(Product)表控制层
 *
 * @author makejava
 * @since 2021-10-07 11:16:52
 */
@RestController
@RequestMapping("product")
@CrossOrigin
public class ProductController {
    /**
     * 服务对象
     */
    @Resource
    private ProductService productService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Product selectOne(Integer id) {
        return this.productService.queryById(id);
    }

    /**
     * 查询货品信息
     * @param list
     * @return
     */
    @RequestMapping("/getProInfo")
    public Map<String,Object> getProInfo(@RequestBody List<String> list){
        return productService.getProInfo(list);
    }

    @RequestMapping("/getAllInfo")
    public  Map<String,Object> getAll(){
        return  productService.selectAll();
    }
}
